<?php
namespace app\msgapi\controller;

use app\BaseController;
use app\msgapi\service\HuihuaCustService;
use app\Request;

/**
 * 会话消息控制器
 */
class Hscust extends BaseController
{
    protected HuihuaCustService $service;
    public function __construct(HuihuaCustService $service)
    {
        parent::__construct(app());
        $this->service = $service;
    }

    /**获取客户列表
     * @param Request $request
     * @return \think\response\Json
     * @throws \think\db\exception\DbException
     */
    public function getCustLst(Request $request){
        $data = $request->only(['uid','type','remark','keyword','corpname','page','limit'],'post');
        return $this->service->getCustLst($data,$request->admin_groupid,$request->adminid);
    }

    /**获取流失客户列表
     * @param Request $request
     * @return \think\response\Json
     * @throws \think\db\exception\DbException
     */
    public function getLostCustomers(Request $request){
        $data = $request->only(['uid','type','delete_type','remark','keyword','corpname','page','limit'],'post');
        return $this->service->getLostCustomers($data,$request->admin_groupid,$request->adminid);
    }

    /**查看客户详情
     * @param Request $request
     * @return \think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function getCustDetail(Request $request){
        $data = $request->only(['external_uid'],'post');
        return $this->service->getCustDetail($data);
    }

}